package cn.hdu.liang.holding;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.ListIterator;

public class Exam12 {

    public static void main(String[] args) {
        List<Integer> intList = Arrays.asList(1, 2, 3, 4, 5, 6, 7);
        System.out.println(intList);
        List<Integer> copyList = new ArrayList<>(intList.size());
        List<Integer> copyList2 = new ArrayList<>(intList.size());
        ListIterator<Integer> it = intList.listIterator(intList.size());
        while(it.hasPrevious()) {
            copyList.add(it.previous());
        }

        it = intList.listIterator(0);
        while(it.hasNext()) {
            copyList2.add(it.next());
        }

        System.out.println(intList);
        System.out.println(copyList);
        System.out.println(copyList2);

    }

}
